package com.atguigu.rule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Author 懵懂的青春
 * @Date 2020/8/1 17:20
 * @Version 1.0
 * @Description
 **/
@Configuration
public class MySelfRule {
    /**
     * 自定义负载均衡策略，不能放在@ComponentScan包及子包下，以免其他负载均衡策略一起修改
     * @return
     */
    @Bean
    public IRule myRule(){
        return new RandomRule();
    }
}
